<?php
namespace Admin\Controller;

class MentoringController extends AdminController {

	#师生关系
	function index() {
		
		$obj = M('Train');
		$count = $obj->where($map)->count();
		import("Common.ORG.Page");
		$page = new \Page($count, 20);
		$show = $page->show();
		$list = $obj->where($map)->order('id desc')->limit($page->firstRow . ',' . $page->listRows)->select();
		foreach ($list as $key => $value) {
			$list[$key]['mentees']=M("Mentees")->where("userid=".$value['menteesID']."")->getField("nickname");
			$list[$key]['mentors']=M("Mentors")->where("userid=".$value['mentorsID']."")->getField("nickname");
		}
		$this->assign('list', $list);
		$this->assign('page', $show);
		$this->display();

	}

	#培训计划
	public function train(){
		$obj = M('Plan');
		$count = $obj->where($map)->count();
		import("Common.ORG.Page");
		$page = new \Page($count, 20);
		$show = $page->show();
		$list = $obj->where($map)->order('id desc')->limit($page->firstRow . ',' . $page->listRows)->select();
		foreach ($list as $key => $value) {
			$list[$key]['mentees']=M("Mentees")->where("userid=".$value['menteesID']."")->getField("nickname");
			$list[$key]['mentors']=M("Mentors")->where("userid=".$value['mentorsID']."")->getField("nickname");
		}
		$this->assign('list', $list);
		$this->assign('page', $show);
		$this->display();
	}
	#培训计划详情
	public function plandetail(){
		$id=(int)I("id");
		if(!isset($id)){
			$this->error(L("_parm_error"));
		}else{
			$map['planID']=$id;
			$list=M("PlanDetails")->where($map)->order("id desc")->select();
			foreach ($list as $key => $value) {
				$list[$key]['mentors']=M("Mentors")->where("userid=".$value['mentorsID']."")->getField("nickname");
			}
			$this->assign('list', $list);
			$this->display();
		}
	}
}
?>